package com.cindata

import com.cindata.dictionary.*

class MortgageLitigationRecord
{

    // 诉讼阶段
    String litigationStage
    //代偿时间
    Date compensatoryDate
    //代偿金额(元)
    BigDecimal compensatoryMoney

    // 案号
    String caseNumber
    //申诉人
    String appeals
    //申诉单位
    String appealsUnit
    //法定代表人
    String legalRepresentative
    //案由
    String handlingSituation
    // 立案时间
    Date filingDate

    //原告
    String accuser
    //原告委托代理人
    String accuserAgent
    //开庭律师
    String courtLawyer
    // 开庭时间
    Date courtDate
    //法院
    String court
    //法官
    String judger

    //审判员
    String judiciary
    // 书记员
    String recorder
    //审判长
    String presidingJudge
    // 审判时间
    Date judgmentDate
    //审判结果
    String judgmentResult

    //上诉人
    String appellant
    //被上诉人
    String appellee
    //上诉请求
    String appealsRequest
    //事实与理由
    String appealReason
    //上诉日期
    Date appealDate

    //开庭律师2
    String courtLawyer2
    //开庭时间2
    Date courtDate2
    //法院2
    String court2
    //法官2
    String judger2

    //审判员2
    String judiciary2
    //书记员2
    String recorder2
    //审判长2
    String presidingJudge2
    //审判时间2
    Date judgmentDate2
    //审判结果2
    String judgmentResult2

    //申请事项
    String applyItem
    //执行案号
    String executeCaseNumber
    //申请执行时间
    Date applyExecueDate
    //执行法官
    String executeJudger
    //执行结果
    String executeResult

    //标的物信息
    String subjectInfo
    //起拍价格
    BigDecimal startPrice
    //起拍时间
    Date startDate
    //结束时间
    Date endDate
    //竞拍结果
    String auctionResult
    //拍卖处置
    String auctionDisposal

    //律所机构
    Account lawAccount
    //拍卖机构
    Account auctioneerAccount

    Date createdDate = new Date()
    Date modifiedDate = new Date()
    User user
    User createBy
    User modifyBy

    static belongsTo = [mortgage: Mortgage, riskWarning: RiskWarning, abnormalMortgageBatch: AbnormalMortgageBatch]

    static constraints = {

        abnormalMortgageBatch nullable: true, blank: true
        mortgage nullable: true, blank: true

        litigationStage nullable: true, blank: true
        caseNumber nullable: true, blank: true
        compensatoryDate nullable: true, blank: true
        compensatoryMoney nullable: true, blank: true
        handlingSituation nullable: true, blank: true
        courtLawyer nullable: true, blank: true
        court nullable: true, blank: true
        judiciary nullable: true, blank: true
        presidingJudge nullable: true, blank: true
        judgmentResult nullable: true, blank: true
        appellant nullable: true, blank: true
        appellee nullable: true, blank: true
        appealsRequest nullable: true, blank: true
        appealReason nullable: true, blank: true
        appealDate nullable: true, blank: true
        courtLawyer2 nullable: true, blank: true
        courtDate2 nullable: true, blank: true
        court2 nullable: true, blank: true
        judger2 nullable: true, blank: true
        judiciary2 nullable: true, blank: true
        recorder2 nullable: true, blank: true
        presidingJudge2 nullable: true, blank: true
        judgmentDate2 nullable: true, blank: true
        judgmentResult2 nullable: true, blank: true
        applyItem nullable: true, blank: true
        executeCaseNumber nullable: true, blank: true
        applyExecueDate nullable: true, blank: true
        filingDate nullable: true, blank: true
        courtDate nullable: true, blank: true
        judgmentDate nullable: true, blank: true
        judger nullable: true, blank: true
        recorder nullable: true, blank: true
        executeJudger nullable: true, blank: true
        executeResult nullable: true, blank: true
        auctionResult nullable: true, blank: true
        auctionDisposal nullable: true, blank: true
        startPrice nullable: true, blank: true
        subjectInfo nullable: true, blank: true
        accuser nullable: true, blank: true
        accuserAgent nullable: true, blank: true
        endDate nullable: true, blank: true
        riskWarning nullable: true, blank: true
        startDate nullable: true, blank: true
        appeals nullable: true, blank: true
        appealsUnit nullable: true, blank: true
        legalRepresentative nullable: true, blank: true
        auctioneerAccount nullable: true, blank: true
        lawAccount nullable: true, blank: true
        createdDate nullable: true, blank: true
        modifiedDate nullable: true, blank: true
        user nullable: true, blank: true
        createBy nullable: true, blank: true
        modifyBy nullable: true, blank: true
    }

    def springSecurityService

    def beforeUpdate()
    {
        modifiedDate = new Date()
        def username = springSecurityService?.getPrincipal()?.username
        modifyBy = User.findByUsername(username)
    }

    def beforeInsert()
    {
        def username = springSecurityService?.getPrincipal()?.username
        createBy = User.findByUsername(username)
    }
}
